© OpenStreetMap contributors, Overture Maps Foundation
OpenStreetMap
Recipe
-
download osm.pbf, in this case data of Hokkaido in Japan.
-
QuackOSM: pbf->Parquet
-
DuckDB: Filter only road features and pack them into GeoPackage(440k features)
-
throw them into PostGIS
-
create some columns used by pgRouting, then run
pgr_createTopology
.
Search Route
I can get result but it has a problem.
Segments of a route is not connected
It is caused by that OpenStreetMap roads are not splitted by intersection.
I guess a network in pgRouting is built by connect each 'end point' of lines. Therefore you shouldn't use OpenStreetMap routes 'as is' but should preprocess them as splitted by intersection. osm2pgrouting
can be used to do so but it needs some dependencies and 'raw' osm-xml (I guess it would be very huge for larger area of data).
Overture Maps
Overture Maps has transportation
layer derived from OpenStreetMap. The difference between OpenStreetMap and OvertureMaps is Overture Maps data is preprocessed as useful for network analysis.
You can see roads of Overture Maps are cleaned.
Download data
download segment
by overturemaps
module of Python.
overturemaps download --bbox=139.7224,41.3446,145.9411,45.5966 -f geoparquet --type=segment -o segment.parquet
Search route
Import features into PostGIS and run pgr_createTopology
. In this case a num of features is 600k or more and it takes to five minutes to create topology.
A result looks good, each segment is smoothly connected.